package cn.ad.enumration;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/9/21.
 */
public enum  CampaignTagFormat {

    COMMON(1, "普通"),  //1 普通订单
    FILLVOLUMN(2,"补量"); //2 补量订单

    private int value;
    private String description;

    private static Map<Integer,String> mappings;

    private static synchronized Map<Integer,String> getMappings(){
        if (mappings==null){
            mappings=new HashMap<>();
            for (CampaignTagFormat tag:CampaignTagFormat.values()){
                mappings.put(tag.value,tag.description);
            }
        }
        return mappings;
    }

    CampaignTagFormat(int value, String description) {
        this.value = value;
        this.description = description;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static String forValues(Integer tag){
        return getMappings().get(tag);
    }
}
